package com.lagou.edu.authority;

import com.lagou.edu.authority.dto.AllocateRoleMenuDTO;
import com.lagou.edu.authority.dto.MenuDTO;
import com.lagou.edu.authority.dto.MenuNodeDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * TODO
 *
 * @author lm
 * @since 2021/11/4 15:52
 */
@FeignClient(value = "edu-authority-boot", path = "/menu")
public interface MenuRemoteService {
    @PostMapping(value = "/saveOrUpdate")
    Boolean saveOrUpdate(@RequestBody MenuDTO menuDTO);

    @GetMapping("/getAll")
    List<MenuDTO> getAllMenu();

    /**
     * 获取菜单树
     *
     * @return
     */
    @GetMapping("/getMenuNodeList")
    List<MenuNodeDTO> getMenuNodeList();

    @GetMapping("/getMenuById")
    MenuDTO getMenuById(@RequestParam("id") Integer id);

    @GetMapping("/getMenuByRoleId")
    List<MenuDTO> getMenuByRoleId(@RequestParam("roleId") Integer roleId);

    @PostMapping("/allocateRoleMenus")
    Boolean allocateRoleMenus(@RequestBody AllocateRoleMenuDTO allocateRoleMenuDTO);
}
